// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

export async function page(
  params: {
    // query
    /** 当前的页码 */
    page?: number;
    /** 页面的容量 */
    size?: number;
    formId?: any;
    keyword?: any;
  },
  options?: { [key: string]: any },
) {
  return request<{
    code:number;
    data: Record<string, any>;
    msg?: string;
  }>('/product-server/api/v1/business_data/page', {
    method: 'POST',
    data: {
      ...params,
    },
    ...(options || {}),
  });
}

export async function formField(
  params: {
    formId?: any;
  },
  options?: { [key: string]: any },
) {
  return request<{
    code:number;
    data: Record<string, any>;
    msg?: string;
  }>('/product-server/api/v1/form_header/find', {
    params,
    ...(options || {}),
  });
}

export async function getForms(
  params: {
    formId?: any;
    page?: any;
    size?: any;
    keyWords?: any;
  },
  options?: { [key: string]: any },
) {
  return request<{
    code:number;
    data: Record<string, any>;
    msg?: string;
  }>('/product-server/api/v1/form_properties/page', {
    method: 'POST',
    data:params,
    ...(options || {}),
  });
}



/** 新建规则 PUT /api/rule */
export async function updateFormData(data: { [key: string]: any }, options?: { [key: string]: any }) {
  return request<{
    code:number;
    data: Record<string, any>;
    msg?: string;
  }>('/product-server/api/v1/business_data/update', {
    data,
    method: 'PUT',
    ...(options || {}),
  });
}

export async function addFormData(data: { [key: string]: any }, options?: { [key: string]: any }) {
  return request<{
    code:number;
    data: Record<string, any>;
    msg?: string;
  }>('/product-server/api/v1/business_data/save', {
    data,
    method: 'POST',
    ...(options || {}),
  });
}

/** 删除规则 DELETE /api/rule */
export async function removeFormData(data: { idList: number[] }, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/product-server/api/v1/business_data/batch_del', {
    data,
    method: 'DELETE',
    ...(options || {}),
  });
}
